import { axios } from '@/utils/request'

const root = '/admin/'

const api = {
  memberTypeList: root + 'custom-form/pageList',
  memberTypeAddOrUpdate: root + 'custom-form/addOrUpdate',
  memberTypeEnable: root + 'custom-form/enable/',
  updateApplyTemplateFile: root + 'member-apply-template/updateApplyTemplateFile',
  getByIdApplyTemplate: root + 'member-apply-template/getByIdApplyTemplate',
  hydwFzrZzmm: '/system/dict/data/type?dictType=hydw_fzr_zzmm', // 政治面貌
  hydwFzrShrz: '/system/dict/data/type?dictType=hydw_fzr_shrz', // 社会任职
  getPosition: '/system/coc-leading-member-position/getList', // 单位职务

  organizationList: root + 'member-organization/getList',
  organizationEdit: root + 'member-organization/edit',
  formEnable: root + 'member-organization/enable/',

  getOrganizationCategoryTree: '/system/memberType/getAddList',
  getIndustryCategoryAllTree:'/system/industry/getAddAllList',
  addOrganizationCategory: '/system/memberType/batchAdd',
  getMemberLevelCategoryTree: '/system/memberLevel/getAddList',
  addMemberLevelCategory: '/system/memberLevel/batchAdd',
  getIndustryCategoryTree: '/system/industry/getAddList',
  addIndustryCategory: '/system/industry/batchAdd'
}

export default api

//会员分类列表
export function MemberTypeList(params) {
  return axios({
    url: api.memberTypeList,
    method: 'get',
    params
  })
}

//会员分类新增、修改
export function MemberTypeAddOrUpdate(data) {
  return axios({
    url: api.memberTypeAddOrUpdate,
    method: 'post',
    data
  })
}

//表单禁用、启用
export function MemberTypeEnable(id, status) {
  return axios({
    url: api.memberTypeEnable + `${id}/${status}`,
    method: 'post'
  })
}

//修改缴费涵续费涵
export function UpdateApplyTemplateFile(data) {
  return axios({
    url: api.updateApplyTemplateFile,
    method: 'post',
    data
  })
}

//获取缴费函、续费函数据
export function getByIdApplyTemplate(id) {
  return axios({
    url: api.getByIdApplyTemplate + `/${id}`,
    method: 'get'
  })
}

/**
 * 政治面貌
 */
export function hydwFzrZzmm() {
  return axios({
    url: api.hydwFzrZzmm,
    method: 'get'
  })
}

/**
 * 入会任职
 */
export function hydwFzrShrz() {
  return axios({
    url: api.hydwFzrShrz,
    method: 'get'
  })
}

/**
 * 单位职务
 */
export function getPosition(params) {
  return axios({
    url: api.getPosition,
    method: 'get',
    params
  })
}

/**
 * 会员架构列表
 */
export function OrganizationList(params) {
  return axios({
    url: api.organizationList,
    method: 'get',
    params
  })
}

/**
 * 会员架构编辑
 */
export function OrganizationEdit(data) {
  return axios({
    url: api.organizationEdit,
    method: 'post',
    data
  })
}

/**
 * 表单启用禁用
 */
export function FormEnable(id, status) {
  return axios({
    url: api.formEnable + `${id}/${status}`,
    method: 'post'
  })
}

/**
 * 查询单位类别
 * @param {*} keyWord
 * @returns
 */
export function getOrganizationCategoryTree(keyWord) {
  return axios({
    url: api.getOrganizationCategoryTree,
    method: 'get'
  })
}

/**
 * 批量添加单位类别
 */
export function addOrganizationCategory(codeList) {
  return axios({
    url: api.addOrganizationCategory,
    method: 'post',
    data: { codeList }
  })
}

/**
 * 查询会员职务类别
 * @param {*} keyWord
 * @returns
 */
export function getMemberLevelCategoryTree(keyWord) {
  return axios({
    url: api.getMemberLevelCategoryTree,
    method: 'get'
  })
}

/**
 * 批量添加会员职务类别
 */
export function addMemberLevelCategory(codeList) {
  return axios({
    url: api.addMemberLevelCategory,
    method: 'post',
    data: { codeList }
  })
}

/**
 * 查询行业类别
 * @returns
 */
export function getIndustryCategoryTree() {
  return axios({
    url: api.getIndustryCategoryTree,
    method: 'get'
  })
}

/**
 * 批量添加行业类别
 */
export function getIndustryCategoryAllTree() {
  return axios({
    url: api.getIndustryCategoryAllTree,
    method: 'get'
  })
}

/**
 * 批量添加行业类别
 */
export function addIndustryCategory(codeList) {
  return axios({
    url: api.addIndustryCategory,
    method: 'post',
    data: { codeList }
  })
}
